home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / comm / bbs / MAX_DoorPack.lha / MAX_DoorPack103 / DoorPack.h < prev    next >
C/C++ Source or Header  |  1995-01-12  |  16KB  |  635 lines

  1.  
  2. /*
  3.             $VER: doorpack.h 1.03 (20.02.95)
  4.  
  5.             Fixed and updated by Marcin Orlowski
  6. */
  7.  
  8. #define CAR if(doormsg->carrier==1) return;
  9. #define DROP if(doormsg->carrier==1) end();
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13. #include <exec/types.h>
  14. #include <exec/ports.h>
  15.  
  16. extern void end( void );
  17. extern void getsvar( int typ, char *mstring );
  18. extern void sendmessage( char mstring[], int nl );
  19. extern void hotkey( char mstring[], char *ostring );
  20. extern void prompt( char mstring[], char *ostring, int len );
  21. extern void sprompt( char mstring[], char *ostring, int len );
  22. extern void showfile( char mstring[] );
  23. extern void twituser( void );
  24. extern void addtime( int howmuch );
  25. extern void newaccess( int now );
  26. extern void MenuFunction( int function, int extra, char *string );
  27. extern void localmessage( char mstring[], int nl );
  28. extern void putmodemchar( char outd );
  29. extern void putscreenchar( char outd );
  30. extern void putdoorchar( char outd );
  31. extern void editfile( char mstring[], int maxlines );
  32. extern int chkfile( char *filename );
  33. extern int getsnum( int typ );
  34. extern int ReadStructure( FILE *fp, char *structure, int length );
  35. extern int WriteStructure( FILE *fp, char *structure, int length );
  36.  
  37. extern struct Task *mytask; /* Pointer to this task so we can name it */
  38.  
  39. void dmain( void );
  40.  
  41.  
  42. /*
  43.  
  44. The following code was kindly supplied by Robert Masters.  It deals with
  45. the MAX's configuration files, as outlined in the #?.text ascii files
  46. included in this archive.
  47.  
  48. */
  49.  
  50. #define MAXS_BBS        1.52
  51.  
  52. #define HEADER_STRING   "M A X's BBS Version 1.52  Copyright . 1992 by Anthony Barrett"
  53. #define HEADER_LENGTH   62
  54.  
  55. struct Section {
  56.    
  57.    char     name[42];
  58.    
  59.    LONG     low_access,
  60.             high_access,
  61.             reply_access,
  62.             max_count;
  63.             
  64.    ULONG    not_used          :23,
  65.             flag_echo         :1,
  66.             flag_files        :1,
  67.             flag_alias        :1,
  68.             flag_lk3          :1,
  69.             flag_lk2          :1,
  70.             flag_lk1          :1,
  71.             flag_del          :1,
  72.             flag_to           :1,
  73.             flag_frm          :1;
  74. };
  75.    
  76.  
  77. struct Fido  
  78.     {
  79.     UBYTE    section_number;
  80.     
  81.     UBYTE    flag_LZH          :1,
  82.             flag_old_filename :1;
  83.             
  84.     char    area_name[40];
  85.     
  86.     USHORT    dest_zone,
  87.             dest_net,
  88.             dest_node,
  89.             dest_point;
  90.             
  91.     char    password[8];
  92.             
  93.     USHORT    opt_bbs_zone,
  94.             opt_bbs_net,
  95.             opt_bbs_node,
  96.             opt_bbs_point;
  97.             
  98.     char    origin_line[58];
  99.     };
  100.  
  101.  
  102. struct Menu 
  103.     {
  104.     UBYTE    key;
  105.  
  106.     ULONG    function,
  107.             extra,
  108.             low_access,
  109.             high_access;
  110.    
  111.     char    string[41];
  112.     };
  113.  
  114.  
  115. struct Config 
  116.     {
  117.     char     header[HEADER_LENGTH-1];             /*don't ask me why it's short one*/
  118.    
  119.     UBYTE    new_files_public  :1,
  120.             esc_control_chars :1,
  121.             flashing_text     :1,
  122.             interlace         :1,
  123.             zmodem_XON_XOFF   :1,
  124.             iconify_on_start  :1,
  125.             zmodem_resume     :1,
  126.             show_connect_info :1;
  127.             
  128.     char    text_files_path[41],
  129.             user_files_path[41],
  130.             message_files_path[41],
  131.             files_files_path[42],
  132.             log_files_path[41],
  133.             bell_sample_filename[41],
  134.             chat_sample_filename[41];
  135.    
  136.     ULONG    bell_sample_play_rate,
  137.             chat_sample_play_rate,
  138.             max_users,
  139.             max_file_size,
  140.             logsize,
  141.             upload_reward,
  142.             sleep_time,
  143.             countdown_time,
  144.             chat_on_time,
  145.             chat_off_time,
  146.             max_chat_pages,
  147.             ud_on_time,
  148.             ud_off_time,
  149.             dimmer_time,
  150.             max_time,
  151.             min_upload_space,
  152.             add_sub_value,
  153.             optimize_messages_time,
  154.             login_time_limit,
  155.             answer_delay,
  156.             iconify_position,
  157.             inactive_days;
  158.    
  159.    char     door_files_path[41];
  160.    
  161.    char     opt_files_paths[30][41];
  162.             
  163.    UBYTE    modem_blank       :3,
  164.             add_ul_reward     :1,
  165.             freeze_ul_clock   :1,
  166.             monochrome_display:1,
  167.             update_dl_log     :1,
  168.             update_cli_log    :1;
  169.                                                                                                  
  170.    USHORT   clock_window_position_x;
  171.    USHORT   clock_window_position_y;
  172.    
  173.    char     attached_files_path[41],
  174.             bbs_font_filename[41],
  175.             window_font_filename[41],
  176.             execute_logoff_filename[41];
  177.    
  178.    ULONG    attached_files_old_days,
  179.             max_bps,
  180.             min_bps;
  181.                        
  182.    char     modem_setup[41],
  183.             _300_connect[41],
  184.             _600_connect[41],
  185.             _1200_connect[41],
  186.             _2400_connect[41],
  187.             _4800_connect[41],
  188.             _9600_connect[41],
  189.             _19200_connect[41],
  190.             _38400_connect[41],
  191.             busy[41],
  192.             no_dial_tone[41],
  193.             device_name[27];
  194.               
  195.    ULONG    serial_blank      :27,
  196.             auto_connect      :1,
  197.             slow_command      :1,
  198.             send_setup_twice  :1,
  199.             locked_bps_rate   :1,
  200.             _7_wire_handshake :1;
  201.  
  202.    UWORD    serial_dev_unit;                /* Here the bugs was */
  203.          
  204.    char     _12000_connect[41],
  205.             _14400_connect[41];
  206.                  
  207.    ULONG    guest_blank       :27,
  208.             guest_afa         :1,
  209.             guest_dn          :1,
  210.             guest_up          :1,
  211.             guest_wr          :1,
  212.             guest_rd          :1;
  213.               
  214.    ULONG    member_blank      :27,
  215.             member_afa        :1,
  216.             member_dn         :1,
  217.             member_up         :1,
  218.             member_wr         :1,
  219.             member_rd         :1;
  220.             
  221.    ULONG    guest_access_level,
  222.             guest_time_limit,
  223.             guest_ratio,
  224.             guest_max_time_bank,
  225.             
  226.             member_access_level,
  227.             member_time_limit,
  228.             member_ratio,
  229.             member_max_time_bank;
  230.             
  231.    struct   Section  section[100];
  232.    
  233.    char     text_strings[350][100],
  234.             macro_strings[20][100],
  235.             
  236.             fido_inbound_path[42],
  237.             fido_outbound_path[42],
  238.             fido_origin_line[58],
  239.             fido_bbs_name[60];
  240.             
  241.    USHORT   bbs_address_zone,
  242.             bbs_address_net,
  243.             bbs_address_node,
  244.             bbs_address_point;
  245.             
  246.    char     sysop_name[20],
  247.             
  248.             make_LZH_string[41],
  249.             unLZH_string[41],
  250.             
  251.             phone_number_dial[21][41],
  252.             
  253.             execute_program_string[21][41];
  254.             
  255.    ULONG    phone_number_dial_time[21],
  256.             execute_program_time[21];
  257.             
  258.    char     phone_number_day_count[21],
  259.             execute_program_day_count[21];
  260.             
  261.    ULONG    dial_blank           :11,
  262.             dial_flags_phone_21  :1,
  263.             dial_flags_phone_20  :1,
  264.             dial_flags_phone_19  :1,
  265.             dial_flags_phone_18  :1,
  266.             dial_flags_phone_17  :1,
  267.             dial_flags_phone_16  :1,
  268.             dial_flags_phone_15  :1,
  269.             dial_flags_phone_14  :1,
  270.             dial_flags_phone_13  :1,
  271.             dial_flags_phone_12  :1,
  272.             dial_flags_phone_11  :1,
  273.             dial_flags_phone_10  :1,
  274.             dial_flags_phone_9   :1,
  275.             dial_flags_phone_8   :1,
  276.             dial_flags_phone_7   :1,
  277.             dial_flags_phone_6   :1,
  278.             dial_flags_phone_5   :1,
  279.             dial_flags_phone_4   :1,
  280.             dial_flags_phone_3   :1,
  281.             dial_flags_phone_2   :1,
  282.             dial_flags_phone_1   :1;
  283.             
  284.    ULONG    execute_blank        :11,
  285.             execute_flags_21     :1,
  286.             execute_flags_20     :1,
  287.             execute_flags_19     :1,
  288.             execute_flags_18     :1,
  289.             execute_flags_17     :1,
  290.             execute_flags_16     :1,
  291.             execute_flags_15     :1,
  292.             execute_flags_14     :1,
  293.             execute_flags_13     :1,
  294.             execute_flags_12     :1,
  295.             execute_flags_11     :1,
  296.             execute_flags_10     :1,
  297.             execute_flags_9      :1,
  298.             execute_flags_8      :1,
  299.             execute_flags_7      :1,
  300.             execute_flags_6      :1,
  301.             execute_flags_5      :1,
  302.             execute_flags_4      :1,
  303.             execute_flags_3      :1,
  304.             execute_flags_2      :1,
  305.             execute_flags_1      :1;
  306.         
  307.    ULONG    max_retries,
  308.             time_out,
  309.             redial_delay,
  310.             fido_on_time,
  311.             fido_off_time,
  312.             message_import_time;
  313.             
  314.    ULONG    fido_blank        :22,
  315.             no_care_import    :1,
  316.             update_log        :1,
  317.             show_cntrl_info   :1,
  318.             fidonet_only      :1,
  319.             allow_waZOO       :1,
  320.             allow_telink      :1,
  321.             allow_send        :1,
  322.             allow_pickup      :1,
  323.             auto_execute      :1,
  324.             auto_fidonet      :1;
  325.                         
  326.    struct   Fido  fido[200];
  327.    };
  328.  
  329.  
  330. struct Config_Menus  
  331.    {
  332.    ULONG    menu_number;
  333.    
  334.    char     text_filename[41];
  335.    
  336.    struct   Menu  menu[10];
  337.    };
  338.  
  339. /* After reading the Config, keep reading Config_Menus until the end of 
  340. the file. There may be more than 1 * 10 Menu structs per menu_number..*/
  341.  
  342. struct File_Data_Header 
  343.    {
  344.    UBYTE    header[HEADER_LENGTH];
  345.    
  346.    ULONG    total_active,
  347.             section_count[100];
  348.    };
  349.  
  350.  
  351. struct File_Data 
  352.    {
  353.    ULONG    date,
  354.             time,
  355.             length,
  356.             downloads;
  357.    
  358.    UBYTE    not_used_A        :4,            
  359.             flag_gone         :1,
  360.             flag_new          :1,
  361.             flag_lock         :1,
  362.             flag_del          :1;
  363.             
  364.    UBYTE    section_number,
  365.             filename[41],
  366.             description[60],
  367.             from[41],
  368.             from_alias[41],
  369.             from_node;
  370.    };
  371.  
  372.  
  373. struct File_Index_Header 
  374.    {
  375.    UBYTE    header[HEADER_LENGTH];
  376.    };
  377.  
  378. struct File_Index 
  379.    {
  380.    UBYTE    filename[41],
  381.             section_number,
  382.                     
  383.             not_used_A        :5,
  384.             flag_new          :1,
  385.             flag_lock         :1,
  386.             flag_del          :1,
  387.             
  388.             reserved;     
  389.    };
  390.  
  391. struct Log_Data_Header 
  392.    {
  393.    UBYTE    header[HEADER_LENGTH];
  394.    
  395.    ULONG    total_active,
  396.             start;
  397.    };
  398.  
  399.  
  400. struct Log_Data 
  401.    {
  402.    UBYTE    name[41],
  403.             exit_code;     /* use enum Exit_Code */
  404.             
  405.    ULONG    logged_on_days,
  406.             logged_on_mins,
  407.             logged_off_days,
  408.             logged_off_mins;
  409.    
  410.    USHORT   messages_read,
  411.             messages_left,
  412.             uploads,
  413.             downloads,
  414.             baud_rate,
  415.             
  416.             not_used_A        :14,
  417.             flag_cli          :1,
  418.             flag_paged        :1; 
  419.    };           
  420.  
  421. enum Exit_Code 
  422.    {
  423.    Normal, Slow_baud_rate, Userfile_full, Lost_carrier,
  424.    Security_violation, Locked_out, Out_of_time, Sleep_disconnect,
  425.    Twited, DOS_read_error, DOS_write_error, Low_mem_error,
  426.    System_event, Forced_hangup, Slow_login, Reserved_BBS
  427.    };
  428.  
  429.  
  430. struct Message_Data_Header 
  431.    {
  432.    UBYTE    header[HEADER_LENGTH];
  433.    
  434.    ULONG    total_active,
  435.             highest,
  436.             section_count[100];
  437.    };
  438.  
  439. struct Message_Data 
  440.    {
  441.    ULONG    message_number,
  442.             date,
  443.             time,
  444.             previous;
  445.             
  446.    USHORT   replies;
  447.    
  448.    ULONG    position;
  449.    
  450.    USHORT   length,
  451.             
  452.             length_space,
  453.             
  454.             not_used_A        :9,
  455.             flag_netmail      :1,
  456.             flag_file_attach  :1,
  457.             flag_import       :1,
  458.             flag_forward      :1,
  459.             flag_locked       :1,
  460.             flag_received     :1,            
  461.             flag_del          :1;
  462.             
  463.             
  464.    UBYTE    section_number,
  465.             from[41],
  466.             to[41],
  467.             subject[72],
  468.             from_alias[41],
  469.             to_alias[41],
  470.             pad;
  471.             
  472.   USHORT    orig_node,
  473.             dest_node,
  474.             orig_net,
  475.             dest_net;
  476.    };
  477.  
  478. struct Message_Index_Header 
  479.    {
  480.    UBYTE    header[HEADER_LENGTH];
  481.    };
  482.  
  483. struct Message_Index 
  484.    {
  485.    ULONG    message_number;
  486.    
  487.    UBYTE    section_number,
  488.    
  489.             not_used_A        :7,
  490.             flag_del          :1;
  491.    };
  492.  
  493. struct User_Data_Header 
  494.    {
  495.    UBYTE    header[HEADER_LENGTH];
  496.    
  497.    ULONG    total_calls;
  498.    };
  499.  
  500.  
  501. struct User_Data 
  502.    {
  503.    UBYTE    name[41],
  504.             suburb[40],
  505.             password[21],
  506.             phone[21],
  507.             computer[21],
  508.             comment[100];
  509.    
  510.    ULONG    time_remain,
  511.             access_level,
  512.             time_limit,
  513.             du_ratio,
  514.             last_message_read,
  515.             page_length,
  516.             calls,
  517.             messages,
  518.             uploads,
  519.             downloads,
  520.             last_date_on,
  521.             last_time_on,
  522.             
  523.             not_used_A        :19,
  524.             flag_file_attach  :1,
  525.             flag_junk_mail    :1,
  526.             flag_file_desc    :1,
  527.             flag_lck          :1,
  528.             flag_cls          :1,
  529.             flag_pause        :1,
  530.             flag_fse          :1,
  531.             flag_ansi         :1,
  532.             flag_bltn         :1,
  533.             flag_dn           :1,
  534.             flag_up           :1,
  535.             flag_wr           :1,
  536.             flag_rd           :1,           
  537.             
  538.             time_bank,
  539.             transfer_protocol,
  540.             max_time_bank;
  541.    };         
  542.  
  543.    
  544. struct User_Index_Header 
  545.    {
  546.    UBYTE    header[HEADER_LENGTH];
  547.    };
  548.  
  549. struct User_Index 
  550.    {
  551.    UBYTE    name[41];
  552.    };
  553.  
  554. /* This is included here just as a place for putting it, but this is the
  555. structure for the data file in my program 'Section_Path'. As several of my 
  556. programs use this data file, I have put the structure here should anyone 
  557. else wish to use it as a quick way of cross refrencing sections to paths.
  558.  
  559. There are some blanks in the struct that will not be used, they were only
  560. there for some future expansion. */
  561.  
  562. struct Section_Path_Data 
  563.    {
  564.    char     section[101],     /* the path no. that each section uses. 127 if not used */
  565.             path[101][81],    /* path names as from FilePaths.text */
  566.             files[80];        /* path to the File.data ect. */
  567.    };
  568.  
  569.  
  570. /* These are for use with the MasterPort functions of MAXs */
  571.  
  572. struct MultiStruct   
  573.     {
  574.     LONG    totalcalls;
  575.     LONG    totalusers;
  576.     LONG    activemessages;
  577.     LONG    highestmessage;
  578.     LONG    lowestmessage;
  579.     LONG    activefiles;
  580.     LONG    msgindexpointer;
  581.     LONG    msgindexsize;
  582.     LONG    fileindexpointer;
  583.     LONG    fileindexsize;
  584.     LONG    numbernodes;
  585.     LONG    onlineusers;
  586.     };
  587.  
  588. struct _DoorMsg 
  589.     {
  590.        struct   Message Door_Msg;
  591.     short    command;
  592.     short    data;
  593.     char     string[80];
  594.     short    carrier;
  595.     };
  596.  
  597. struct MasterPort 
  598.     {
  599.     struct   Message _Door_Msg;
  600.     WORD     command;
  601.     LONG     data;
  602.     char     string[80];
  603.     short    carrier;
  604.     };
  605.  
  606.  
  607. /* arguments for getsvar()function */
  608.  
  609. #define GETS_USERNAME    1
  610. #define GETS_PASSWORD    2
  611. #define GETS_SUBURB      3
  612. #define GETS_CITY        4
  613. #define GETS_STATE       5
  614. #define GETS_POSTCODE    6
  615. #define GETS_DOORPATH    7
  616. #define GETS_MAINPATH    8
  617. #define GETS_DATE        9
  618. #define GETS_TIME       10
  619. #define GETS_PHONE     100
  620. #define GETS_COMPUTER  101
  621. #define GETS_COMMENT   102
  622.  
  623.  
  624. /* arguments for getsnum()function */
  625.  
  626. #define GETN_ACCESS         1
  627. #define GETN_EXPERTMODE 2
  628. #define GETN_CREDITS        3
  629. #define GETN_CALLS      4
  630. #define GETN_SYSCALLS   5
  631. #define GETN_GFXMODE    6
  632. #define GETN_TIMEREMAIN 7
  633. #define GETN_COLUMNS    8
  634. #define GETN_ROWS       9
  635.